from typing import List


def insert_sort(in_ls: List) -> List:
    """
    采用插入排序算法对输入数组进行升序排序
    :param in_ls:以列表形式展示的乱序数组
    :return: 以列表形式展示的升序数组
    """
    for i in range(1, len(in_ls)):
        j = i - 1
        key = in_ls[i]
        while j>=0 and in_ls[j] > key:
            in_ls[j+1] = in_ls[j]
            j -= 1
        in_ls[j+1] = key

    out_ls = in_ls.copy()
    # 请补充
    pass
    return out_ls


if __name__ == '__main__':
    a = [17, 24, 28, 40, 13, 14, 22, 32, 40, 21, 48, 4, 47, 8, 37, 18]
    # a = eval(input())
    if isinstance(a, List):
        b = insert_sort(a)
        print(b)
    else:
        print("格式错误，请输入数组")
